package com.card.entity.manager;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.card.consts.SystemConsts;
import com.card.entity.object.EntityObject;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * ClassName: User <br/>
 * Function: 用户表. <br/>
 * date: 2018年8月29日 下午12:37:59 <br/>
 * 
 * @author lishuai11
 * @version
 * @since JDK 1.8
 */
@ApiModel
@Entity
@Table(name = "`USER`")
@EntityListeners(AuditingEntityListener.class)
public class User extends EntityObject {

	private static final long serialVersionUID = 7446444606001941793L;

	public User() {
		super();
	}

	/**
	 * 
	 * 手机号注册
	 * 
	 * @param mobile
	 * @param password
	 */
	public User(String mobile, String password) {
		this.mobile = mobile;
		this.password = password;
		this.loginType = SystemConsts.LOGIN_PHONE;
	}

	@ApiModelProperty(name = "userId", value = "用户id", hidden = true)
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "`USER_ID`")
	private int userId;

	@ApiModelProperty(name = "mobile", value = "手机号", hidden = true)
	@Column(name = "`MOBILE`", unique = true, nullable = false, updatable = false)
	private String mobile;

	@ApiModelProperty(name = "password", value = "密码", hidden = true)
	@Column(name = "`PASSWORD`")
	private String password;

	@ApiModelProperty(name = "nickName", value = "昵称", dataType = "String")
	@Column(name = "`NICKNAME`")
	private String nickName;

	@ApiModelProperty(name = "icon", value = "头像", dataType = "String")
	@Column(name = "`ICON`")
	private String icon;

	@ApiModelProperty(name = "gender", value = "性别", dataType = "int", notes = "1:男；2:女；0:未知")
	@Column(name = "`GENDER`", nullable = false)
	private int gender = 0;

	@ApiModelProperty(name = "loginType", value = "登陆方式", hidden = true)
	@Column(name = "`LOGINTYPE`", nullable = false)
	private String loginType;

	@ApiModelProperty(name = "locked", value = "冻结", hidden = true)
	@Column(name = "`LOCKED`")
	private boolean locked = false;

	@ApiModelProperty(name = "deviceCode", value = "设备号", hidden = true)
	@Column(name = "`DEVICECODE`")
	private String deviceCode;

	@ApiModelProperty(name = "inviteCode", value = "邀请码", hidden = true)
	@Column(name = "`INVITE_CODE`")
	private String inviteCode;

	@ApiModelProperty(name = "city", value = "市区")
	@Column(name = "`CITY`")
	private String city;

	@ApiModelProperty(name = "totalScore", value = "总积分", hidden = true)
	@Column(name = "`TOTAL_SCORE`")
	private int totalScore = 0;

	/**
	 * @return the userId
	 */
	public int getUserId() {
		return userId;
	}

	/**
	 * @param userId
	 *            the userId to set
	 */
	public void setUserId(int userId) {
		this.userId = userId;
	}

	/**
	 * @return the mobile
	 */
	public String getMobile() {
		return mobile;
	}

	/**
	 * @param mobile
	 *            the mobile to set
	 */
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password
	 *            the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the nickName
	 */
	public String getNickName() {
		return nickName;
	}

	/**
	 * @param nickName
	 *            the nickName to set
	 */
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	/**
	 * @return the icon
	 */
	public String getIcon() {
		return icon;
	}

	/**
	 * @param icon
	 *            the icon to set
	 */
	public void setIcon(String icon) {
		this.icon = icon;
	}

	/**
	 * @return the gender
	 */
	public int getGender() {
		return gender;
	}

	/**
	 * @param gender
	 *            the gender to set
	 */
	public void setGender(int gender) {
		this.gender = gender;
	}

	/**
	 * @return the loginType
	 */
	public String getLoginType() {
		return loginType;
	}

	/**
	 * @param loginType
	 *            the loginType to set
	 */
	public void setLoginType(String loginType) {
		this.loginType = loginType;
	}

	/**
	 * @return the locked
	 */
	public boolean isLocked() {
		return locked;
	}

	/**
	 * @param locked
	 *            the locked to set
	 */
	public void setLocked(boolean locked) {
		this.locked = locked;
	}

	/**
	 * @return the deviceCode
	 */
	public String getDeviceCode() {
		return deviceCode;
	}

	/**
	 * @param deviceCode
	 *            the deviceCode to set
	 */
	public void setDeviceCode(String deviceCode) {
		this.deviceCode = deviceCode;
	}

	/**
	 * @return the inviteCode
	 */
	public String getInviteCode() {
		return inviteCode;
	}

	/**
	 * @param inviteCode
	 *            the inviteCode to set
	 */
	public void setInviteCode(String inviteCode) {
		this.inviteCode = inviteCode;
	}

	/**
	 * @return the city
	 */
	public String getCity() {
		return city;
	}

	/**
	 * @param city
	 *            the city to set
	 */
	public void setCity(String city) {
		this.city = city;
	}

	/**
	 * @return the totalScore
	 */
	public int getTotalScore() {
		return totalScore;
	}

	/**
	 * @param totalScore the totalScore to set
	 */
	public void setTotalScore(int totalScore) {
		this.totalScore = totalScore;
	}

}
